package com.tuzhi.base.jpa.enums;

public enum AndOrOperate {
    and(1, "and"),//条件以and的形式添加到SQL查询语句
    or(2, "or");//条件以OR的形式添加到SQL查询语句

    private AndOrOperate(int type, String name) {
        this.type = type;
        this.name = name;
    }

    private int type;
    private String name;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    /**
     * getAndOrOperateByName
     *
     * @param name
     * @return
     */
    public static AndOrOperate getAndOrOperateByName(String name) {

        if (AndOrOperate.or.name.equalsIgnoreCase(name)) {
            return AndOrOperate.or;
        }
        return AndOrOperate.and;
    }
}
